package cn.com.thinker.core.module.dao.jpa;

import cn.com.thinker.core.dao.jpa.support.ThinkerRepository;
import cn.com.thinker.core.module.entity.Dic;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;

import java.util.List;

@RepositoryRestResource(path = "people")
public interface DicRepository extends ThinkerRepository<Dic, String> {

    Dic findByDicKey(@Param("dicKey") String dicKey);

    @Query("select p.dicValue from Dic p where p.dicKey= :dicKey and p.userId= :userId")
    String withDicKeyAndUserId(@Param("dicKey") String dickey, @Param("userId") String userId);

    List<Dic> queryByUserId(@Param("userId") Long userId);


}
